export interface ConfigDef {
    id: string;
    descEn: string;
    descCn: string;
    defaultValue: unknown;
    demoValue?: unknown;
    validValue: (value: unknown) => string | null;
    url: string;
}

export const ConfigDefList: ConfigDef[] = [
    {
        id: "arithmetic-side-effects-allowed",
        descEn: `Suppress checking of the passed type names in all types of operations.
        If a specific operation is desired, consider using arithmetic_side_effects_allowed_binary or arithmetic_side_effects_allowed_unary instead.`,
        descCn: `禁止在所有类型的操作中检查传递的类型名称。
        如果需要特定的操作，请考虑使用arithmetic_side_effects_allowed_binary和arithmetic_side_effects_allowed_unary代替。`,
        defaultValue: {}, //["SomeType", "AnotherType"]
        demoValue: ["SomeType", "AnotherType"],
        validValue: (value: unknown): string | null => {
            if (Array.isArray(value)) {
                const arry = value as unknown[];
                if (arry.length == 0) {
                    return `请使用{}配置`;
                }
                for (const v of arry) {
                    if (typeof v != "string") {
                        return "数组内必须是字符串";
                    }
                }
                return null;
            } else if (typeof value == "object") {
                if (Object.entries(value as object).length != 0) {
                    return `请使用["xx","yy"]的格式`;
                }
                return null;
            }
            return "只支持字符串数组和空对象";
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#arithmetic-side-effects-allowed",
    },
    {
        id: "arithmetic-side-effects-allowed-binary",
        descEn: `Suppress checking of the passed type pair names in binary operations like addition or multiplication.
        Supports the "*" wildcard to indicate that a certain type won't trigger the lint regardless of the involved counterpart. `,
        descCn: `禁止在加法或乘法等二进制运算中检查传递的类型对名称。
        支持“*”通配符，表示某个类型不会触发lint，无论涉及的对应类型如何。`,
        defaultValue: [], //[["SomeType" , "f32"], ["AnotherType", "*"]]
        demoValue: [["SomeType", "f32"], ["AnotherType", "*"]],
        validValue: (value: unknown): string | null => {
            if (!Array.isArray(value)) {
                return "必须是二维字符串数组";
            }
            const arry = value as unknown[];
            for (const innerArry of arry) {
                if (!Array.isArray(innerArry)) {
                    return "必须是二维字符串数组";
                }
                if (innerArry.length != 2) {
                    return "内部数组长度必须为2";
                }
                if (typeof innerArry[0] != "string") {
                    return "内部数组第一个参数不是字符串";
                }
                if (typeof innerArry[1] != "string") {
                    return "内部数组第二个参数不是字符串";
                }
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#arithmetic-side-effects-allowed-binary",
    },
    {
        id: "arithmetic-side-effects-allowed-unary",
        descEn: `Suppress checking of the passed type names in unary operations like "negation" (-).`,
        descCn: `禁止在一元运算（如“负数”（-））中检查传递的类型名。`,
        defaultValue: {}, //["SomeType", "AnotherType"]
        demoValue: ["SomeType", "AnotherType"],
        validValue: (value: unknown): string | null => {
            if (Array.isArray(value)) {
                const arry = value as unknown[];
                if (arry.length == 0) {
                    return `请使用{}配置`;
                }
                for (const v of arry) {
                    if (typeof v != "string") {
                        return "数组内必须是字符串";
                    }
                }
                return null;
            } else if (typeof value == "object") {
                if (Object.entries(value as object).length != 0) {
                    return `请使用["xx","yy"]的格式`;
                }
                return null;
            }
            return "只支持字符串数组和空对象";
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#arithmetic-side-effects-allowed-unary",
    },
    {
        id: "avoid-breaking-exported-api",
        descEn: "Suppress lints whenever the suggested change would cause breakage for other crates.",
        descCn: "只要建议的改变会导致破坏其他规则，就要抑制规则。",
        defaultValue: true,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#avoid-breaking-exported-api",
    },
    {
        id: "msrv",
        descEn: "The minimum rust version that the project supports",
        descCn: "项目支持的最低 rust 版本",
        defaultValue: "None", //Option<String>
        demoValue: "1.3.0",
        validValue: (value: unknown): string | null => {
            if (typeof value != "string") {
                return "必须是字符串";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#msrv",
    },
    {
        id: "cognitive-complexity-threshold",
        descEn: "The maximum cognitive complexity a function can have",
        descCn: "函数可以具有的最大认知复杂性",
        defaultValue: 25,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#cognitive-complexity-threshold",
    },
    {
        id: "disallowed-names",
        descEn: `The list of disallowed names to lint about. NB: bar is not here since it has legitimate uses. The value ".." can be used as part of the list to indicate, that the configured values should be appended to the default configuration of Clippy. By default, any configuration will replace the default value.`,
        descCn: "不允许查找的名称列表。注意：bar不在这里，因为它有合法用途。..值可用作列表的一部分，以指示应将配置的值追加到 Clippy 的默认配置。默认情况下，任何配置都将替换默认值。",
        defaultValue: ["foo", "baz", "quux"],
        validValue: (value: unknown): string | null => {
            if (Array.isArray(value)) {
                const arry = value as unknown[];
                for (const v of arry) {
                    if (typeof v != "string") {
                        return "数组内必须是字符串";
                    }
                }
                return null;
            }
            return "必须是字符串数组";
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#disallowed-names",
    },
    {
        id: "doc-valid-idents",
        descEn: `The list of words this lint should not consider as identifiers needing ticks. The value ".." can be used as part of the list to indicate, that the configured values should be appended to the default configuration of Clippy. By default, any configuration will replace the default value. `,
        descCn: "此规则不应将单词列表视为需要刻度的标识符。..值可用作列表的一部分，以指示应将配置的值追加到 Clippy 的默认配置。默认情况下，任何配置都将替换默认值。",
        defaultValue: ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "DirectX", "ECMAScript", "GPLv2", "GPLv3", "GitHub", "GitLab", "IPv4", "IPv6", "ClojureScript", "CoffeeScript", "JavaScript", "PureScript", "TypeScript", "NaN", "NaNs", "OAuth", "GraphQL", "OCaml", "OpenGL", "OpenMP", "OpenSSH", "OpenSSL", "OpenStreetMap", "OpenDNS", "WebGL", "TensorFlow", "TrueType", "iOS", "macOS", "FreeBSD", "TeX", "LaTeX", "BibTeX", "BibLaTeX", "MinGW", "CamelCase"],
        validValue: (value: unknown): string | null => {
            if (Array.isArray(value)) {
                const arry = value as unknown[];
                for (const v of arry) {
                    if (typeof v != "string") {
                        return "数组内必须是字符串";
                    }
                }
                return null;
            }
            return "必须是字符串数组";
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#doc-valid-idents",
    },
    {
        id: "too-many-arguments-threshold",
        descEn: "The maximum number of argument a function or method can have",
        descCn: "函数或方法可以具有的最大参数数",
        defaultValue: 7,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#too-many-arguments-threshold",
    },
    {
        id: "type-complexity-threshold",
        descEn: "The maximum complexity a type can have",
        descCn: "类型可以具有的最大复杂性",
        defaultValue: 250,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#type-complexity-threshold",
    },
    {
        id: "single-char-binding-names-threshold",
        descEn: "The maximum number of single char bindings a scope may have",
        descCn: "作用域可能具有的最大单字符绑定数",
        defaultValue: 4,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#single-char-binding-names-threshold",
    },
    {
        id: "too-large-for-stack",
        descEn: "The maximum size of objects (in bytes) that will be linted. Larger objects are ok on the heap",
        descCn: "当前规则限制在栈上对象的最大大小(单位字节)。大的对象可以放在堆上。",
        defaultValue: 200,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#too-large-for-stack",
    },
    {
        id: "enum-variant-name-threshold",
        descEn: "The minimum number of enum variants for the lints about variant names to trigger",
        descCn: "枚举的字符大小写最多转变次数",
        defaultValue: 3,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#enum-variant-name-threshold",
    },
    {
        id: "enum-variant-size-threshold",
        descEn: "The maximum size of an enum's variant to avoid box suggestion",
        descCn: "枚举变量的最大大小，避免使用box的建议",
        defaultValue: 200,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#enum-variant-size-threshold",
    },
    {
        id: "verbose-bit-mask-threshold",
        descEn: "The maximum allowed size of a bit mask before suggesting to use 'trailing_zeros'",
        descCn: "建议使用“trailing_zeros”之前位掩码的最大允许大小",
        defaultValue: 1,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#verbose-bit-mask-threshold",
    },
    {
        id: "literal-representation-threshold",
        descEn: "The lower bound for linting decimal literals",
        descCn: "使用非十进制表示数字的下限",
        defaultValue: 16384,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#literal-representation-threshold",
    },
    {
        id: "trivial-copy-size-limit",
        descEn: "The maximum size (in bytes) to consider a Copy type for passing by value instead of by reference.",
        descCn: "考虑按值而不是按引用传递的类型的最大大小（以字节为单位）",
        defaultValue: "None", //Option<u64>
        demoValue: 16384,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#trivial-copy-size-limit",
    },
    {
        id: "pass-by-value-size-limit",
        descEn: "The minimum size (in bytes) to consider a type for passing by reference instead of by value.",
        descCn: "考虑通过引用而不是按值传递的类型时的最小大小（以字节为单位）。",
        defaultValue: 256,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#pass-by-value-size-limit",
    },
    {
        id: "too-many-lines-threshold",
        descEn: "The maximum number of lines a function or method can have",
        descCn: "函数或方法可以具有的最大行数",
        defaultValue: 100,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#too-many-lines-threshold",
    },
    {
        id: "array-size-threshold",
        descEn: "The maximum allowed size for arrays on the stack",
        descCn: "堆栈上数组允许的最大大小",
        defaultValue: 512000,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#array-size-threshold",
    },
    {
        id: "vec-box-size-threshold",
        descEn: "The size of the boxed type in bytes, where boxing in a Vec is allowed",
        descCn: "Vec<Box>的最大大小",
        defaultValue: 4096,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#vec-box-size-threshold",
    },
    {
        id: "max-trait-bounds",
        descEn: "The maximum number of bounds a trait can have to be linted",
        descCn: "绑定特质的最大数量",
        defaultValue: 3,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#max-trait-bounds",
    },
    {
        id: "max-struct-bools",
        descEn: "The maximum number of bool fields a struct can have",
        descCn: "结构可以具有的最大布尔字段数",
        defaultValue: 3,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#max-struct-bools",
    },
    {
        id: "max-fn-params-bools",
        descEn: "The maximum number of bool parameters a function can have",
        descCn: "函数可以具有的最大布尔参数数",
        defaultValue: 3,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#max-fn-params-bools",
    },
    {
        id: "warn-on-all-wildcard-imports",
        descEn: "Whether to allow certain wildcard imports (prelude, super in tests).",
        descCn: "是否允许某些通配符导入",
        defaultValue: false,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#warn-on-all-wildcard-imports",
    },
    {
        id: "disallowed-macros",
        descEn: "The list of disallowed macros, written as fully qualified paths.",
        descCn: "不允许的宏列表，编写为完全限定路径",
        defaultValue: [], //Vec<crate::utils::conf::DisallowedPath>
        demoValue: [{ path: "std::println" }, { path: "serde::Serialize", reason: "no serializing" }],
        validValue: (value: unknown): string | null => {
            if (!Array.isArray(value)) {
                return "必须是对象数组";
            }
            const arry = value as unknown[];
            for (const v of arry) {
                if (typeof v != "object") {
                    return "数组内必须是对象";
                }
                let hasPath = false;
                for (const [objKey, objValue] of Object.entries(v as object)) {
                    if (typeof objValue != "string") {
                        return "对象值必须是字符串";
                    }
                    if (objKey == "path") {
                        hasPath = true;
                    } else if (objKey == "reason") {
                        //do nothing
                    } else {
                        return `未知对象属性${objKey}`;
                    }
                }
                if (!hasPath) {
                    return "缺失path属性";
                }
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#disallowed-macros",
    },
    {
        id: "disallowed-methods",
        descEn: "The list of disallowed methods, written as fully qualified paths.",
        descCn: "不允许的方法列表，编写为完全限定路径。",
        defaultValue: [], //Vec<crate::utils::conf::DisallowedPath>
        demoValue: [{ path: "std::time::Instant::now" }, { path: "std::vec::Vec::leak", reason: "no leaking memory" }],
        validValue: (value: unknown): string | null => {
            if (!Array.isArray(value)) {
                return "必须是对象数组";
            }
            const arry = value as unknown[];
            for (const v of arry) {
                if (typeof v != "object") {
                    return "数组内必须是对象";
                }
                let hasPath = false;
                for (const [objKey, objValue] of Object.entries(v as object)) {
                    if (typeof objValue != "string") {
                        return "对象值必须是字符串";
                    }
                    if (objKey == "path") {
                        hasPath = true;
                    } else if (objKey == "reason") {
                        //do nothing
                    } else {
                        return `未知对象属性${objKey}`;
                    }
                }
                if (!hasPath) {
                    return "缺失path属性";
                }
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#disallowed-methods",
    },
    {
        id: "disallowed-types",
        descEn: "The list of disallowed types, written as fully qualified paths.",
        descCn: "不允许的类型列表，写为完全限定的路径。",
        defaultValue: [], //Vec<crate::utils::conf::DisallowedPath>
        demoValue: [{ path: "std::net::TcpListener" }, { path: "std::net::Ipv4Addr", reason: "no IPv4 allowed" }],
        validValue: (value: unknown): string | null => {
            if (!Array.isArray(value)) {
                return "必须是对象数组";
            }
            const arry = value as unknown[];
            for (const v of arry) {
                if (typeof v != "object") {
                    return "数组内必须是对象";
                }
                let hasPath = false;
                for (const [objKey, objValue] of Object.entries(v as object)) {
                    if (typeof objValue != "string") {
                        return "对象值必须是字符串";
                    }
                    if (objKey == "path") {
                        hasPath = true;
                    } else if (objKey == "reason") {
                        //do nothing
                    } else {
                        return `未知对象属性${objKey}`;
                    }
                }
                if (!hasPath) {
                    return "缺失path属性";
                }
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#disallowed-types",
    },
    {
        id: "unreadable-literal-lint-fractions",
        descEn: "Should the fraction of a decimal be linted to include separators.",
        descCn: "是否应使用小数点的小数部分以包含分隔符。",
        defaultValue: true,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#unreadable-literal-lint-fractions",
    },
    {
        id: "upper-case-acronyms-aggressive",
        descEn: "Enables verbose mode. Triggers if there is more than one uppercase char next to each other",
        descCn: "启用详细模式。如果有多个大写字符彼此相邻，则触发",
        defaultValue: false,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#upper-case-acronyms-aggressive",
    },
    {
        id: "matches-for-let-else",
        descEn: "Whether the matches should be considered by the lint, and whether there should be filtering for common types.",
        descCn: "是否应该考虑匹配，以及是否应该对常见类型进行筛选。",
        defaultValue: "WellKnownTypes", //crate::manual_let_else::MatchLintBehaviour
        validValue: (value: unknown): string | null => {
            if (typeof value != "string") {
                return "必须是字符串";
            }
            if (!["AllTypes", "WellKnownTypes", "Never"].includes(value as string)) {
                return "必须是AllTypes，WellKnownTypes，Never中的一个值";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#matches-for-let-else",
    },
    {
        id: "cargo-ignore-publish",
        descEn: "For internal testing only, ignores the current publish settings in the Cargo manifest.",
        descCn: "对于内部测试，忽略Cargo中的publish设置。",
        defaultValue: false,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#cargo-ignore-publish",
    },
    {
        id: "standard-macro-braces",
        descEn: `Enforce the named macros always use the braces specified.`,
        descCn: `强制命名宏始终使用指定的大括号。`,
        defaultValue: [], //Vec<crate::nonstandard_macro_braces::MacroMatcher>
        demoValue: [{ name: "macro_name", brace: "(" }],
        validValue: (value: unknown): string | null => {
            if (!Array.isArray(value)) {
                return "必须是对象数组";
            }
            const arry = value as unknown[];
            for (const v of arry) {
                if (typeof v != "object") {
                    return "数组内必须是对象";
                }
                let hasName = false;
                let hasBrace = false;
                for (const [objKey, objValue] of Object.entries(v as object)) {
                    if (typeof objValue != "string") {
                        return "对象值必须是字符串";
                    }
                    if (objKey == "name") {
                        hasName = true;
                    } else if (objKey == "brace") {
                        hasBrace = true;
                    } else {
                        return `未知对象属性${objKey}`;
                    }
                }
                if (!hasName) {
                    return "缺失name属性";
                }
                if (!hasBrace) {
                    return "缺失brace属性";
                }
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#standard-macro-braces",
    },
    {
        id: "enforced-import-renames",
        descEn: "The list of imports to always rename, a fully qualified path followed by the rename.",
        descCn: "要始终重命名的导入列表，一个完全限定的路径，后跟重命名",
        defaultValue: [], //Vec<crate::utils::conf::Rename>
        demoValue: [{ path: "serde_json::Value", rename: "JsonValue" }],
        validValue: (value: unknown): string | null => {
            if (!Array.isArray(value)) {
                return "必须是对象数组";
            }
            const arry = value as unknown[];
            for (const v of arry) {
                if (typeof v != "object") {
                    return "数组内必须是对象";
                }
                let hasPath = false;
                let hasRename = false;
                for (const [objKey, objValue] of Object.entries(v as object)) {
                    if (typeof objValue != "string") {
                        return "对象值必须是字符串";
                    }
                    if (objKey == "path") {
                        hasPath = true;
                    } else if (objKey == "rename") {
                        hasRename = true;
                    } else {
                        return `未知对象属性${objKey}`;
                    }
                }
                if (!hasPath) {
                    return "缺失path属性";
                }
                if (!hasRename) {
                    return "缺失rename属性";
                }
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#enforced-import-renames",
    },
    {
        id: "allowed-scripts",
        descEn: "The list of unicode scripts allowed to be used in the scope.",
        descCn: "允许在作用域中使用的字符集。",
        defaultValue: ["Latin"],
        validValue: (value: unknown): string | null => {
            if (Array.isArray(value)) {
                const arry = value as unknown[];
                for (const v of arry) {
                    if (typeof v != "string") {
                        return "数组内必须是字符串";
                    }
                }
                return null;
            }
            return "必须是字符串数组";
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#allowed-scripts",
    },
    {
        id: "enable-raw-pointer-heuristic-for-send",
        descEn: "Whether to apply the raw pointer heuristic to determine if a type is Send.",
        descCn: "当发送类型是，是否应用原始指针启发式来确定类型",
        defaultValue: true,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#enable-raw-pointer-heuristic-for-send",
    },
    {
        id: "max-suggested-slice-pattern-length",
        descEn: `When Clippy suggests using a slice pattern, this is the maximum number of elements allowed in the slice pattern that is suggested. If more elements are necessary, the lint is suppressed. `,
        descCn: "当 Clippy 建议使用slice时，这是允许的最大元素数。如果需要更多元素，则抑制当前规则",
        defaultValue: 3,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#max-suggested-slice-pattern-length",
    },
    {
        id: "await-holding-invalid-types",
        descEn: "",
        descCn: "",
        defaultValue: [], //Vec<crate::utils::conf::DisallowedPath>
        demoValue: [{ path: "OtherCustomLockType", reason: "Relies on a thread local" }],
        validValue: (value: unknown): string | null => {
            if (!Array.isArray(value)) {
                return "必须是对象数组";
            }
            const arry = value as unknown[];
            for (const v of arry) {
                if (typeof v != "object") {
                    return "数组内必须是对象";
                }
                let hasPath = false;
                for (const [objKey, objValue] of Object.entries(v as object)) {
                    if (typeof objValue != "string") {
                        return "对象值必须是字符串";
                    }
                    if (objKey == "path") {
                        hasPath = true;
                    } else if (objKey == "reason") {
                        //do nothing
                    } else {
                        return `未知对象属性${objKey}`;
                    }
                }
                if (!hasPath) {
                    return "缺失path属性";
                }
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#await-holding-invalid-types",
    },
    {
        id: "max-include-file-size",
        descEn: "The maximum size of a file included via include_bytes!() or include_str!(), in bytes",
        descCn: "使用include_bytes!()或include_str!()加载文件的最大大小(单位字节)",
        defaultValue: 1000000,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#max-include-file-size",
    },
    {
        id: "allow-expect-in-tests",
        descEn: `Whether expect should be allowed in test functions or #[cfg(test)]`,
        descCn: "是否允许在测试函数中使用expect",
        defaultValue: false,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#allow-expect-in-tests",
    },
    {
        id: "allow-unwrap-in-tests",
        descEn: "Whether unwrap should be allowed in test functions or #[cfg(test)]",
        descCn: "是否允许在测试函数中使用unwrap",
        defaultValue: false,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#allow-unwrap-in-tests",
    },
    {
        id: "allow-dbg-in-tests",
        descEn: "Whether dbg! should be allowed in test functions or #[cfg(test)]",
        descCn: "是否允许在测试函数中使用dbg!",
        defaultValue: false,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#allow-dbg-in-tests",
    },
    {
        id: "allow-print-in-tests",
        descEn: "Whether print macros (ex. println!) should be allowed in test functions or #[cfg(test)]",
        descCn: "是否允许在测试函数中使用print",
        defaultValue: false,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#allow-print-in-tests",
    },
    {
        id: "large-error-threshold",
        descEn: "The maximum size of the Err-variant in a Result returned from a function",
        descCn: "函数范围Result中的Err的最大大小",
        defaultValue: 128,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#large-error-threshold",
    },
    {
        id: "ignore-interior-mutability",
        descEn: "A list of paths to types that should be treated like Arc, i.e.",
        descCn: "向Arc类型一样处理的类型路径列表",
        defaultValue: ["bytes::Bytes"],
        validValue: (value: unknown): string | null => {
            if (Array.isArray(value)) {
                const arry = value as unknown[];
                for (const v of arry) {
                    if (typeof v != "string") {
                        return "数组内必须是字符串";
                    }
                }
                return null;
            }
            return "必须是字符串数组";
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#ignore-interior-mutability",
    },
    {
        id: "allow-mixed-uninlined-format-args",
        descEn: `Whether to allow mixed uninlined format args, e.g. format!("{} {}", a, foo.bar)`,
        descCn: "是否允许混合无内联格式参数",
        defaultValue: true,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#allow-mixed-uninlined-format-args",
    },
    {
        id: "suppress-restriction-lint-in-const",
        descEn: "Whether to suppress a restriction lint in constant code. In same cases the restructured operation might not be unavoidable, as the suggested counterparts are unavailable in constant code. This configuration will cause restriction lints to trigger even if no suggestion can be made.",
        descCn: "是否在常量代码中禁止显示限制规则。在这种情况下，重组操作可能并非不可避免，因为 建议的对应项在常量代码中不可用。这配置将导致限制规则触发 如果不能提出任何建议。",
        defaultValue: false,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#suppress-restriction-lint-in-const",
    },
    {
        id: "missing-docs-in-crate-items",
        descEn: "Whether to only check for missing documentation in items visible within the current crate.",
        descCn: "是否只检查当前crate内可见的物品中是否缺失文档。",
        defaultValue: false,
        validValue: (value: unknown): string | null => {
            if (typeof value != "boolean") {
                return "必须是true或false";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#missing-docs-in-crate-items",
    },
    {
        id: "future-size-threshold",
        descEn: "The maximum byte size a Future can have, before it triggers the clippy::large_futures lint",
        descCn: "Future的最大大小(单位字节)，以避免触发clippy::large_futures提示",
        defaultValue: 16384,
        validValue: (value: unknown): string | null => {
            if (!Number.isInteger(value)) {
                return "必须是整数";
            }
            const n = value as number;
            if (n <= 0) {
                return "必须大于0";
            }
            return null;
        },
        url: "https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#future-size-threshold",
    },
];